package com.cskaoyan.controller;

import com.cskaoyan.bean.common.BaseRespVo;

import com.cskaoyan.bean.vo.zxw.StatGoodsVo;
import com.cskaoyan.bean.vo.zxw.StatOrderVo;
import com.cskaoyan.bean.vo.zxw.StatUserVo;
import com.cskaoyan.service.AdminStatService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 统计报表模块
 * @author 曾添乐啦
 * @since 2022/12/30 08:57
 */

@RestController
@RequestMapping("admin/stat")
public class AdminStatController {

    @Autowired
    AdminStatService adminStatService;

    //用户统计

    @RequestMapping("user")
    public BaseRespVo userStat(){
        //接收响应参数和请求参数都复用StatGoodsBo来接收和响应
        StatUserVo statUserVo =adminStatService.findUserStat();
        return BaseRespVo.ok(statUserVo);
    }

    //订单统计

    @RequestMapping("order")
    public BaseRespVo orderStat(){
        //接收响应参数和请求参数都复用StatOrderBo来接收和响应
        StatOrderVo statOrderVo = adminStatService.findOrderStat();
        return BaseRespVo.ok(statOrderVo);
    }

    //商品统计

    @RequestMapping("goods")
    public BaseRespVo goodsStat(){
        //接收响应参数和请求参数都复用StatOrderBo来接收和响应
        StatGoodsVo statGoodsVo=adminStatService.findGoodsStat();
        return BaseRespVo.ok(statGoodsVo);
    }
}
